#!/usr/bin/env/ python

if __name__ == "__main__":
    sum = 0
    for i in range(1 , 1001):
        sum = sum + (i ** i)

    print str(sum)[-10:]
